<template>
  <!-- 挤压报表 -->
  <div class="outbound">
    <div class="card-search" style="height: 70px;">
      <!-- <el-form
        size="small"
        :inline="true"
        :model="formInline"
        class="demo-form-inline"
      >
        <el-form-item label="时间">
          <el-date-picker
            v-model="formInline.timeLine"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            format="yyyy-MM-dd HH:mm:00"
            value-format="yyyy-MM-dd HH:mm:00"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="">
          <el-button
            icon="el-icon-search"
            type="primary"
            @click="onSubmit('查询')"
            >查询</el-button
          >
        </el-form-item>
      </el-form> -->
    </div>
    <div class="card-table">
      <el-table
        :header-cell-style="getRowClass"
        :data="tableData"
        style="width: 100%"
      >
        <el-table-column align="center" label="时间" width="width">
          <template slot-scope="{ row }">
            {{ row.createTime }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="类型" width="width">
          <template slot-scope="{ row }">
            {{ row.status }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="压力" width="width">
          <template slot-scope="{ row }">
            {{ row.MaxMap.压力最大值.value }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="抽真空" width="width">
          <template slot-scope="{ row }">
            {{ row.MinMap.抽真空最小值.value }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="料室" width="width">
          <template slot-scope="{ row }">
            {{ row.MaxMap.料室温度最大值.value }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="变形区" width="width">
          <template slot-scope="{ row }">
            {{ row.MaxMap.变形区温度最大值.value }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="时长" width="width">
          <template slot-scope="{ row }">
            {{
              `${(
                (Number(Date.parse(row.endTime)) -
                  Number(Date.parse(row.startTime))) /
                1000 /
                60
              ).toFixed(2)}分钟`
            }}
          </template>
        </el-table-column>
      </el-table>

      <!-- 分页 -->
      <div class="pagin" v-if="total >= pageSize">
        <el-pagination
          background
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currPage"
          :page-size="pageSize"
          layout="total, prev, pager, next, jumper"
          :total="total"
        >
        </el-pagination>
      </div>
    </div>
  </div>
</template>

<script>
import { pasteReportData } from "@/api/smallCalcination/index.js";
export default {
  name: "cruciblesContent",
  components: {},
  data() {
    return {
      total: "",
      pageSize: 13,
      currPage: 1,
      tableData: [],
    };
  },
  computed: {},

  watch: {},
  created() {},
  mounted() {
    this.getAllData();
  },
  methods: {
    async getAllData() {
      const params = {
        pageSize: this.pageSize,
        currPage: this.currPage,
      };
      let {
        data: { data },
      } = await pasteReportData(params);
      console.log(data);
      this.total = data.total 
      this.tableData = data.data;
    },
    onSubmit(a) {
      if (a === "查询") {
        this.currPage = 1;
      }

      this.getAllData();
      // this.$message({
      //   message: "查询成功",
      //   type: "success",
      // });
    },

    handleSizeChange(val) {
      this.pageSize = val;
      this.getAllData();
    },
    handleCurrentChange(val) {
      this.currPage = val;
      this.getAllData();
    },
  },
};
</script>
<style  scoped>
.pagin {
  display: flex;
  justify-content: right;
  padding: 12px 12px 0 0;
}
.pagin  .el-pager .active {
  background-color: $primary !important;
}
</style>
